<template>
   <ul class="todo-main">
    <Item v-for="todo,index in todos" :key="todo.id" :todo="todo" 
      :deleteTodo="deleteTodo" :index="index" :checkTodo="checkTodo"></Item> 
  </ul>
</template>

<script>
import Item from './Item/index.vue'
export default {
  name: 'List',
  components: {Item},
  // 声明接收属性
  // props: ['todos'] // 指定属性名
  props: {// 指定属性名/数据类型
    todos: {
      type: Array,
      // validator (val) {
      //   return val.length<4
      // }
    },
    deleteTodo: Function,
    checkTodo: Function,
  }
}
</script>

<style scoped>
.todo-main {
  margin-left: 0px;
  border: 1px solid #ddd;
  border-radius: 2px;
  padding: 0px;
}

.todo-empty {
  height: 40px;
  line-height: 40px;
  border: 1px solid #ddd;
  border-radius: 2px;
  padding-left: 5px;
  margin-top: 10px;
}
</style>

